<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:c="http://java.sun.com/jsp/jstl/core"
      xmlns:f="http://java.sun.com/jsf/core">
    <h:head>
        <title>User Right</title>
    </h:head>
    <h:body>
        You can change the right for client
        <br />
        <br />
        <table>
            <th>User</th>
            <th>Ban</th>
            <th>Grade</th>
        <c:forEach var="client" items="#{userManager.listOfAllClient}">
            <h:form>
            <tr>
                <td>
                    <h:outputText value="#{client.name}"/>
                </td>

                <td>
                    <h:selectBooleanCheckbox value="#{client.ban}"  valueChangeListener="#{changeUserRight.changeBan}"/>
                </td>
                <td>
                    <h:selectOneListbox id="grade" size="1" value="#{client.grade}" valueChangeListener="#{changeUserRight.changeGrade}">
                        <f:selectItem id="item1" itemLabel="Admin" itemValue="0" />
                         <f:selectItem id="item2" itemLabel="CoAdmin" itemValue="1" />
                          <f:selectItem id="item3" itemLabel="User" itemValue="5" />

                    </h:selectOneListbox>
                </td>
                <td>
                    <h:commandButton value="Apply" action="#{changeUserRight.changeRight(client.name, client.grade, client.ban)}"/>
                </td>
            </tr>
                
            </h:form>
            </c:forEach> 
        </table>
        <h:link outcome="/market.xhtml" value="Back to the market">
            <f:param name="cid" value="#{userManager.conversation.id}"/>
        </h:link>
    </h:body>
</html>

